package dk.ucn.rejsealarmen;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class StopAlarm extends Activity{

	TextView alarmTextView;
	Button stopAlarmButton;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_stop_alarm);
		savedInstanceState = getIntent().getExtras();
		alarmTextView = (TextView) findViewById(R.id.alarmTextView);
		alarmTextView.setText(savedInstanceState.getString("alarmText"));
		
		stopAlarmButton = (Button) findViewById(R.id.stopAlarmButton);
		
		stopAlarmButton.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				stopPlayService();
			}
		});
		
	}

	private void stopPlayService() {
		Toast.makeText(getApplicationContext(), "stopPlayService er called",
				Toast.LENGTH_SHORT).show();
		stopService(new Intent(this, AlarmService.class));
		finish();
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.stop_alarm, menu);
		return true;
	}

}
